package org.jha.base;

import java.awt.Component;
import java.io.File;

import com.sun.jna.Native;
import com.sun.jna.platform.win32.WinDef.HWND;
import com.sun.jna.win32.StdCallLibrary;

public class CommonTools {
	public static HWND createHWNDByComponent(Component parent) {
		return new HWND(Native.getComponentPointer(parent));
	}

	public static String getLibPath() {
		File f = new File("");
		return f.getAbsolutePath() + File.separator + "lib";
	}

	@SuppressWarnings("unchecked")
	public static <T extends StdCallLibrary> T loadLibrary(String libPath,
			Class<T> clazz) {
		return (T) Native.loadLibrary(libPath, clazz);
	}
}
